package com.woniuxy.service.log;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.woniuxy.entity.Log;
import com.woniuxy.mapper.LogMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
@Transactional
public class LogServiceImpl implements LogService{
    @Autowired
    private LogMapper logMapper;
    @Override
    public PageInfo<Log> selLog(int page, int size) {
        PageHelper.startPage(page,size);
        List<Log> logs = logMapper.selectByExample(null);
        PageInfo info = new PageInfo(logs);
        return info;
    }

    @Override
    public int addLog(Log log) {
        return logMapper.insert(log);
    }

    @Override
    public int deleteLogData() {
        return logMapper.deleteByExample(null);
    }

}
